﻿@model IEnumerable<CmsDomain>
           
@{
    Layout = "~/admin/Templates/TelerikAdministration.cshtml";
    ViewBag.Title = "Domains";
}

<h1 class="g-clear">
	<i class="b-icon b-icon_h b-icon_h_config"></i>
	<span class="b-overflow">
		Domains management
		<span class="b-intro-text">The following table shows all domains.</span> 
	</span>  
</h1>

<div id="TabStrip" class="t-widget t-tabstrip t-header">
    @Html.Partial("ConfigurationMenu", 2)
	<div style="display: block;" id="TabStrip-1" class="t-content t-state-active">
		<div class="t-content-inner g-clear">
			<p class="clear-left">
			    <a class="b-button" href="@Url.Action("add", "cmsdomain")">Add domain</a>
			</p>
			@{Html.RenderPartial("ErrorPanel");}
			@(Html.Telerik().Grid(Model).Name("DomainGrid")
			        .Columns(columns =>
			        {
			            columns.Bound(p => p.Site.SiteName);
			            columns.Bound(p => p.Hostname);                        
			            columns.Bound(p => p.DateCreated).Format("{0:dd/MM/yyyy}").ClientTemplate("<#= $.telerik.formatString('{0:dd/MM/yyyy}', DateCreated) #>");
			            columns.Bound(p => p.Id);
			            columns
                            .Template(@<text><a class="b-icon b-icon_delete" title="Delete" href="@Url.Action("delete", "cmsdomain", new { id = item.Id })">Delete</a></text>)
                            .ClientTemplate("<a class='b-icon b-icon_delete' title='Delete' href='" + @Url.Action("delete", "cmsdomain") + "/<#=Id#>'>Delete</a>")
			            .Title("Delete");
			        })
			                            .DataBinding(dataBinding =>
			                            {
			                                dataBinding.Ajax().Select("_index", "cmsdomain");
			                            })
			                            .Scrollable(scrolling => scrolling.Enabled(false))
			                            .Sortable(sorting => sorting.Enabled(true))
			                            .Pageable(paging => paging.Style(GridPagerStyles.Numeric).Total(ViewBag.Total).PageSize(ViewBag.PageSize).Enabled(ViewBag.Total > ViewBag.PageSize))
			
			                    )
			@{Html.RenderPartial("GridSizer", (int)ViewBag.PageSize);}
		</div>
	</div>
</div>